home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / util / batsh153.zip / BATSH.TXT < prev    next >
Text File  |  1995-03-11  |  14KB  |  328 lines

  1.             Welcome to BATSH version 1.53
  2.             -----------------------------
  3.  
  4. Usage:    To run WINDOWS commands from a file. Line by Line.
  5. ------    Like BATCH (.BAT) files in DOS, but with some WINDOWS
  6.           specific commands, and not all the DOS features.
  7.           For WINDOWS 3.1
  8.  
  9. Install:
  10. --------
  11. Place the files BATSH.EXE and BATSH.TXT anywhere on the disk.
  12. Then write with NOTEPAD a text file with one command per line.
  13.   (See below a description of available commands.)
  14. Give the text file an extension .BSH and associate with
  15. File-Manager the program BATSH.EXE. [File - Associate...].
  16.   (Include the exact program location in the association.)
  17. Run your new command-file with a double click. 
  18.  
  19. To install your command-file in Program-Manager, you can drag the
  20. file with the mouse from File-Manager to a Program-Manager group.
  21. For this procedure, both File- and Program-Manager must be visible
  22. on the WINDOWS screen.
  23.  
  24. License:
  25. --------
  26. I give this program away for free. 
  27. It's features will never reach the standard of a commercial
  28. product, but it may suit you, if you need a few commands only.
  29. You are not allowed to modify the program, sell it, or use it
  30. as part of a commercial software package.
  31. The Author has no warranty, obligations or liability for any problems
  32. that may be encountered using this program.
  33.  
  34.  
  35. Commands:
  36. ---------
  37. Parameters in [] brackets are marked as optional, for using the
  38. option, you must type it without the brackets.
  39. For commands returning an ERRORLEVEL, the value for successful 
  40. operation is 0, 
  41.  
  42. ASK var txt 
  43.    (let the user assign a value to a variable.)
  44.    (The old value of an existing variable is given as default.)
  45.    txt - message
  46.          The combination backslash-n \n is translated to newline.
  47.          Limits: total text ~90 characters  total lines - 3
  48.    var - variable name to assign response.( For the variable
  49.          $PASSWORD, typed characters are shown as *.)
  50.    return value - errorlevel 2 if empty
  51.  
  52. CHOICE k1,k2,k3 txt
  53.    (select by different keys  -with errorlevel returned- )
  54.    (not exactly the DOS 6.x equivalent)
  55.    (k1 is the default key on time-out -errorlevel 1-)
  56.    (you must mention the options in the text message.)
  57.    (the keys are not shown)
  58.    k1-k9 - a key letter (k1 is the default key)
  59.            (never case sensitive)
  60.    txt   - message
  61.            The combination backslash-n \n is translated to newline.
  62.            Limits: total text ~120 characters  total lines - 3
  63.    return value - errorlevel according to the position on the 
  64.                   command line: k1 ->1  k2 ->2 ....
  65.  
  66.    special keys: $S Space     
  67.                  $E Enter
  68.                  $A any other key -except ALT- that is not in the key list
  69.                  # and number - time-out value in seconds 
  70.  
  71. CLOSE txt
  72.    (close window with title -txt- [with save])
  73.     txt  :substring of a window title
  74.     return value - errorlevel 2 if window not found
  75.  
  76. COPY file1 file2 
  77.     (copy files - single files only)
  78.     file1,file2   - full filename
  79.     ! existing files will be overwritten
  80.     ! compressed (MS compress) files will be expanded
  81.     return value - errorlevel 2 if file not found
  82.                    errorlevel 3 for copy errors
  83.  
  84. DEL file
  85.     (delete a file - single file only)
  86.     ! if possible, access restrictions are reset before deletion
  87.     return value -  errorlevel 2 if file not found
  88.                     errorlevel 3 for file access errors
  89.  
  90. EXACT sw
  91.    (all txt parameters are treated case sensitive by default)
  92.     sw   ON   (default)
  93.          OFF
  94. EXIT
  95.    (stop processing and quit BATSH.EXE.)
  96.  
  97. file
  98.    (run a DOS or WINDOWS program -including PIF and BAT files)
  99.     file  :program filename with optional startup parameters
  100.     return value - errorlevel 2 if file not found
  101.                    >2 for other errors
  102.     if wait is on, processing waits for launched program to close
  103.  
  104. GOTO txt 
  105. :txt
  106.    (jump with processing to line :txt, never case sensitive)
  107.  
  108. ICON [file]
  109.    (change the icon image) 
  110.    file: (optional) the first icon from this file is loaded.
  111.          without file parameter, the default BATSH icon is assigned.
  112.          WINDOWS default icons are loaded with the reserved words
  113.              STOP
  114.              INFO
  115.              EXCLAMATION
  116.              QUESTION
  117.    return value - errorlevel 2 if file not found. 
  118.                   errorlevel 3 if icon is invalid. 
  119. IF [not] condition statement
  120.    (specify the conditions under which a statement will be executed)
  121.    conditions:
  122.       ERRORLEVEL number - true for equal or higher errorlevel
  123.       EXIST file  (the first matching name will be assigned to the
  124.                    variable $FILE )
  125.       NETPORT dev (check if the devicename -dev- is a remote device.
  126.                    The network name is returned in the variable $NET)
  127.                    dev   : device name  LPT1-9 or D:-Z:
  128.                    errorlevel 2 if network not installed or
  129.                                 network-error
  130.       REMOTE txt  (substring of a remote service 
  131.                    returns the corresponding device name in $NET)
  132.                    errorlevel 2 if network not installed or
  133.                                 network-error
  134.       WINDOW 'window title substring' in quotes if it includes spaces
  135.       string1==string2  - compare two strings
  136.    statement :BATSH command
  137. LABEL [txt]
  138.    (change the title of the BATSH.EXE icon)
  139.    txt :new title  (default :filename of running script file as title)
  140. MESSAGE [lbl]
  141.    txt
  142.    [txt]
  143. .[lblok],[sec]
  144.    (multiple lines of text txt are displayed.)
  145.    lbl   - messagebox title (default MESSAGE)
  146.    txt   - single or multiple text lines.
  147.             a line should not be longer than 50 characters
  148.             variables get translated 
  149.    .     - the end of the message lines.
  150.             until here, all lines are treated as message.
  151.    the end-line must start with a dot (with optional parameters)
  152.    lblok - The default button label is OK.
  153.             You may type your own label.
  154.    sec   - optional time-out value in seconds. (default 20 seconds)
  155.            A value of 0 will disable the time-out function.
  156. NETADD dev txt [pass]
  157.     (new connection or reconnect)
  158.     dev   : device name  LPT1-LPT9 or D:-Z: ?:
  159.               LPT4: - LPT9: are not supported in all the networks.
  160.               ?: takes the first free disk name for connection
  161.                  and returns the connected drive name in $NET
  162.     txt   : connection string
  163.                 \\server-name\service-name
  164.             or  \\server\service%%user-name   with optional user-name
  165.             Due to variable substitution, the character % must be 
  166.             typed in BATSH files as %%
  167.             Microsoft Network, has a limit of 12 characters for
  168.             the service-name (including optional user-name).
  169.     pass  : optional password
  170.     return value - errorlevel >0 for various network errors
  171. NETSTOP [QUIT] dev
  172.     (stop network connection)
  173.     dev   : device name  LPT1-9 or D:-Z:
  174.     QUIT  : use this keyword to ignore open files and print-jobs
  175.             forced disconnection
  176.     return value - errorlevel >0 for various network errors
  177. PLAY file
  178.    (play WAVE soundfile)
  179.     return value - errorlevel 2 if file not found
  180. PRINT file    !! file gets deleted !!
  181.    (print a print-file to the WINDOWS defined default printer)
  182.    file    -name of a file with raw-data.
  183.    return value - errorlevel 2 if file not found
  184.    !! The file is deleted automatically after printing.
  185.       If you want to keep it, you must copy it first.
  186.    !! This function is using PRINT-Manager. Some strange printer
  187.       drivers do not print with the spooler active, and can therefore
  188.       not be used with this command. 
  189. PRINTER # txt
  190.    (set WINDOWS default printer)
  191.    #    number 1..9  - Output port LPT1: - LPT9:
  192.    txt  substring of an installed printer driver
  193.    return value - errorlevel 2 if printer driver not found
  194.                   or printer not defined
  195.  
  196. QUIT txt
  197.    (quit window with title -txt- [w/o save])
  198.    txt     :substring of a window title
  199.    return value - errorlevel 2 if window not found
  200. REM  txt  
  201. ; txt
  202.    (3 types of comment lines, including empty lines)
  203.     txt     :comment
  204. RESTART
  205.    (restart WINDOWS)
  206.     return value - errorlevel 2 if an application refuses to close
  207. RUN [sw] txt
  208.    (to define the display status at startup of a program) 
  209.    (-some programs use their on startup display status- )
  210.     sw (optional)
  211.        hide :start program -txt- hidden
  212.        icon :start program -txt- as icon
  213.     txt     :program file name and optional parameters
  214.     return value - errorlevel 2 if file not found 
  215.                    >2 for other errors
  216.     if wait is on, processing waits for launched program to close
  217.  
  218. SET var=txt - set variable to value txt
  219. SET var=    - remove variable
  220.  
  221. SHOW sw txt
  222.    ( modify the display status of an existing window)
  223.     sw  HIDE 
  224.         NORMAL
  225.         ICON      
  226.     txt      :substring of a window title
  227.     no txt - the BATSH.EXE icon is hidden or visible
  228.     return value - errorlevel 2 if window not found
  229. TRACE sw
  230.    (each command is shown in a message-box - before execution)
  231.    (for debugging purpose)
  232.     sw   ON   
  233.          OFF  (default)
  234. WAIT sw  
  235.    (general wait on/off toggle or wait for a specific event)
  236.     sw - ON   (default) wait for launched programs to be closed
  237.          OFF 
  238.          DROP - wait until a file is dropped on BATSH-icon
  239.            The filename is returned in the variable $DROP.
  240.            A hidden BATSH icon is made visible before the wait.
  241.            For multiple files, the name of the first is kept.  
  242.          time in seconds - wait processing 
  243. WAITCLOSE [sec] txt
  244.    (wait until window -txt- is closed.)
  245.    (if more than one match, the first is monitored)
  246.     sec      :time-out in seconds (optional)
  247.     txt      :substring of a window title
  248.     return value - errorlevel 2 if window not found
  249.                    errorlevel 3 if time-out reached.
  250. WAITOPEN [sec] txt
  251.    (wait until window -txt- is open.)
  252.     sec      :time-out in seconds (optional)
  253.     txt      :substring of a window title
  254.     return value - errorlevel 2 if window is already open
  255.                    errorlevel 3 if time-out reached.
  256.  
  257.  
  258. Special Environment variables:
  259. ------------------------------
  260. BATSH variables can be at any place on a line
  261. Before executing a command all text-parts with %1 - %9 
  262. are replaced with the corresponding commandline parameters.
  263. %var%  is replaced with a predefined variable or a set variable.
  264. All variables are stored in uppercase. Values may have lower-
  265. and upper-case text.
  266.  
  267. $FILE     - this variable is set from an IF EXIST command 
  268. $DROP     - the first file-name from a WAIT DROP command
  269. $PASSWORD - when set with the ASK command, typed characters
  270.             are shown as *.
  271. $HELP     - default: BATSH.TXT
  272. $CLOSE    - nothing
  273.             The variable $HELP and $CLOSE define a file or a program
  274.             that activates, when the user selects the corresponding
  275.             menu option. Programs (not files) may have parameters.
  276.             The parameters get converted to upper case.
  277.             You can disable the help option by setting $HELP to empty.
  278.             The file BATSH.TXT should be read-only if the default TXT
  279.             file viewer allows editing.
  280. $INSTANCE - 1 if no other BATSH.EXE program is running. 
  281. $NET      - device name from an IF REMOTE or NETADD ?: command.
  282.           - network name from an IF NETPORT command.
  283. $$var     - variables with $$ are kept in WINDOWS memory (global).
  284.                they can be accessed from each instance of the
  285.                BATSH.EXE program, and get deleted only when
  286.                WINDOWS is stopped or when they are set to
  287.                empty with the command SET $$var= 
  288.             limitation: the global space is 256 characters only
  289.                for names and assigned values.  
  290.  
  291. The DOS environment variables are defined at startup, but
  292. BATSH variables with equal names do have priority. 
  293.  
  294.  
  295. Hints:
  296. ------
  297. BATSH command files are called from within a BATSH file
  298.   with the command: BATSH.EXE file-name. If WAIT is on (default),
  299.   processing waits for the branched BATSH file to return.
  300. Be careful with searching window titles.
  301.   The procedure:   LABEL Waiting to close Clock 
  302.                    WAITCLOSE Clock              
  303.   is waiting for the BATSH icon closing and not for the Clock
  304.   program.
  305. To use printer-ports LPT4 - LPT9 for network printing, BATSH 
  306.   will add missing devices to the [ports] section of WIN.INI.
  307.   Not all the networks support these devices, and some treat
  308.   these ports different from LPT1-3:.
  309. For missing DOS commands you can use BATSH to run DOS 
  310.   batch-files. 
  311.   To hide running DOS commands you must create a PIF file.
  312.   Define the BAT file as ' display windowed' and 'close
  313.   on exit'. Use the BATSH command RUN HIDE or RUN ICON to
  314.   activate the PIF file. If you give the PIF file the same
  315.   name as the BAT file, you can RUN the BAT file directly.
  316. For more WINDOWS control you can run recorded macros.
  317.   Use the WINDOWS supplied recorder and record a macro.
  318.   Assign it a shortcut key and store the macro in a file.
  319.   Run the macro from BATSH as RECORDER -H key macro-file.
  320.  
  321.  
  322. ----------------------------------------------------------------
  323.     Thomas Nyffenegger, FMI, PoBox 2543, 4002 Basel, CH
  324.     Email: nyffenegger@fmi.ch
  325.  
  326. ----------------------------------------------------------------
  327.  
  328.